﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QiHe.EQ
{
    public partial class Add_TempEQ : Form
    {
        DataSet DeptList;
        public Add_TempEQ()
        {
            InitializeComponent();
        }

        private void Add_TempEQ_Load(object sender, EventArgs e)
        {
            MedEQ.Service1 sop = new MedEQ.Service1();
            DeptList = sop.HSP_Department_List(DataTemp.HSPID);

            comboBox1.DataSource = DeptList.Tables[0];
            comboBox1.DisplayMember = "Name";
            comboBox1.ValueMember = "DeptNumber";
            textBox3.Text = comboBox1.SelectedValue.ToString();
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void label7_Click(object sender, EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            MedEQ.Service1 sop = new MedEQ.Service1();
            DeptList = sop.Department_List_By_PID(comboBox1.SelectedValue.ToString());

            comboBox2.DataSource = DeptList.Tables[0];
            comboBox2.DisplayMember = "Name";
            comboBox2.ValueMember = "DeptNumber";
            textBox3.Text = comboBox1.SelectedValue.ToString();
        }

        private void comboBox2_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            MedEQ.Service1 sop = new MedEQ.Service1();
            DeptList = sop.Department_List_By_PID(comboBox2.SelectedValue.ToString());

            comboBox3.DataSource = DeptList.Tables[0];
            comboBox3.DisplayMember = "Name";
            comboBox3.ValueMember = "DeptNumber";
            textBox3.Text = comboBox2.SelectedValue.ToString();
        }

        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            textBox3.Text = comboBox3.SelectedValue.ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
           string  EQflag = Guid.NewGuid().ToString();

            MedEQ.Service1 sop = new MedEQ.Service1();
            string log = sop.AddEQ_Full( EQflag,"*", textBox1.Text.ToString(), textBox2.Text.ToString(),
                textBox6.Text.ToString(), textBox4.Text.ToString(), "*","0",
                "0", textBox3.Text.ToString().Trim(), DataTemp.HSPID, "医疗设备",
                "固定资产","427","427", "427",
                       "无", textBox5.Text.ToString(), "0", "0", "0", "无", "无", "0","2", "1");
          
            
            if (log.Equals("1"))

                MessageBox.Show("添加成功");
        }
    }

       
}
